home *** CD-ROM | disk | FTP | other *** search
- /* strerror.c From TC Bible page 283 Use strerror to retrieve an error
- message corresponding to an error number */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <io.h>
- #include <string.h>
- main()
- {
- int handle=100;
- char *errmsg;
-
- /* Generate an error condition by closing a file with a non-existant
- file handle 100 */
-
- if(close(handle) == -1)
- {
- errmsg = strerror(errno);
- printf("Error closing file: %s", errmsg);
- }
-
- }